cmake_minimum_required(VERSION 3.24)
project(src)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)


set(CMAKE_PREFIX_PATH "C:/Private/Code/Qt/6.2.4/mingw_64/lib/cmake")



find_package(Qt6 COMPONENTS
        Core
        Gui
        Widgets
        REQUIRED)

add_executable(src main.cpp
        Rely/Base_Widget/header/Base_Widget.h
        Rely/Client/header/Base_Client.h
        Rely/Title_Button/Close_Button/header/Close_Button.h
        Rely/Title_Button/Qss/Close_Button_Q.h
        Rely/Title_Button/Qss/Max_Button_Q.h
        Rely/Title_Button/Qss/Mini_Button_Q.h
        Rely/Title_Button/Max_Button/header/Max_Button.h
        Rely/Title_Button/Mini_Button/header/Mini_Button.h
        Dialog/LDF_Dialog/header/LDF_Dialog.h
        Dialog/LDF_Dialog/source/LDF_Dialog.cpp
        Dialog/Widget_Move/header/Widget_Move.h
        Widget/LDF_Widget/header/LDF_Widget.h
        Widget/Widget_Event/header/Widget_Event.h
        Widget/LDF_Widget/source/LDF_Widget.cpp


        Create_Project/header/Create_Project_D.h
        Create_Project/source/Create_Project_D.cpp
        Create_Project/Qss/Create_Project_Q.h


        Create_Table/header/Create_Table.h
        Create_Table/source/Create_Table.cpp
        Create_Table/Qss/Create_Table_Q.h

        LDF_Table/header/LDF_Table.h
        LDF_Table/source/LDF_Table.cpp

        New_Table/header/New_Table.h
        New_Table/source/New_Table.cpp

        Table_Menu/header/Table_Menu.h
        Table_Menu/source/Table_Menu.cpp

        Open_File_Dialog/header/Open_File_Dialog.h
        Open_File_Dialog/source/Open_File_Dialog.cpp
        Open_File_Dialog/Qss/Open_File_Dialog_Qss.h


        Descriptive_Widget/header/Descriptive_Widget.h
        Descriptive_Widget/source/Descriptive_Widget.cpp
        Descriptive_Widget/Qss/Descripttive_Dialog_Qss.h

        Descriptive_Widget/header/Data_Science.h
        Descriptive_Widget/source/Data_Science.cpp
        Chart/header/Line_Chart.h Chart/source/Line_Chart.cpp Chart/header/Bar_Chart.h Chart/source/Bar_Chart.cpp Chart/header/Scatter_Plot.h Chart/source/Scatter_Plot.cpp)



target_link_libraries(src
        Qt::Core
        Qt::Gui
        Qt::Widgets
        )

if (WIN32)
    set(DEBUG_SUFFIX)
    if (MSVC AND CMAKE_BUILD_TYPE MATCHES "Debug")
        set(DEBUG_SUFFIX "d")
    endif ()
    set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}")
    if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
        set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
        if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
            set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
        endif ()
    endif ()
    if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll")
        add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E make_directory
                "$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
        add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E copy
                "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
                "$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
    endif ()
    foreach (QT_LIB Core Gui Widgets)
        add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E copy
                "${QT_INSTALL_PATH}/bin/Qt6${QT_LIB}${DEBUG_SUFFIX}.dll"
                "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
    endforeach (QT_LIB)
endif ()
